<%@ tag language="java" pageEncoding="UTF-8"%>

<%@ attribute name="list" required="true" rtexprvalue="true"%>
<%@ attribute name="value" rtexprvalue="true"%>
<%@ attribute name="multiple"%>
<%@ attribute name="onclick"%>
<%@ attribute name="id"%>
<%@ attribute name="name" rtexprvalue="true"%>
<%@ attribute name="label" rtexprvalue="true"%>
<%@ attribute name="required" rtexprvalue="true"%>
<%@ attribute name="single" rtexprvalue="true"%>
<%@ attribute name="help" rtexprvalue="true"%>
<%@ attribute name="raw" rtexprvalue="true"%>
<%@ attribute name="onchange" rtexprvalue="true"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="base" uri="/WEB-INF/mytags.tld"%>

<c:if test="${required==null}">
	<c:set var="required" value="false" />
</c:if>

<c:if test="${raw==null}">
	<base:map var="items" value="${list}" />
</c:if>

<c:choose>
	<c:when test="${single==null}">
		<c:set var="single" value="1" />
	</c:when>
	<c:when test="${single==1}">
		<c:set var="single" value="3" />
	</c:when>
	<c:otherwise>
		<c:set var="single" value="1" />
	</c:otherwise>
</c:choose>

<th><c:if test="${required}">
	<label class="requireField">*</label>
</c:if> <label>${label}:</label></th>
<td colspan="${single}">
	<select name="${name}"
		<c:if test="${id!=null}"> id="{id}"</c:if>
		<c:if test="${multiple!=null}"> multiple="${multiple}"</c:if>
		<c:if test="${onclick!=null}"> onclick="${onclick}"</c:if>
		<c:if test="${onchange!=null}"> onchange="${onchange}"</c:if>>
	
		<c:forEach items="${items}" var="item">
			<option value="${item.key}"
				<c:if test="${item.key==value}"> selected="selected"</c:if>>${item.value}</option>
		</c:forEach>
	</select>${help}
</td>
